Developer --> Technical Publications
PATHHardware Documentation > USB Devices > Mac OS USB DDK API Reference


USBGetFrameNumberImmediate

The USBGetFrameNumberImmediate function returns the current frame number for the specified device. The function completes synchronously and is the recommended function to use for making time calculations for a class driver. It can be called at any execution level. This function also supports multiple USB bus implementations.

OSStatus USBGetFrameNumberImmediate(USBPB *pb);

Required fields in the USBPB parameter block for the USBGetFrameNumberImmediate function are

--> pbLength
Length of parameter block
--> pbVersion
Parameter block version number
--> usbCompletion
The completion routine
--> usbRefcon
General-purpose value passed back to the completion routine
--> usbReference
Device, interface, or endpoint reference
--> usbReqCount
Size of buffer (0 or size of UInt64)
--> usbBuffer
Nil or pointer to a UInt64 structure for full 64 bits of frame data.
<-- usbActCount
Size of data returned
<-- usbFrame
Low 32 bits of the current frame number

In multiple USB bus configurations, each bus has an independent frame count. The USBGetFrameNumberImmediate function takes any device, interface, or endpoint reference as input and returns the current frame number for the bus on which that device, interface, or endpoint is connected.

The frame count for each bus is maintained internally by the USB software as a 64 bit value. The USBGetNextFrameNumberImmediate function allows a driver to get either the low 32 bits of this value in the parameter block, or the full 64 bit value in a UInt64 structure. To get the low 32 bits, specify a value of nil in usbBuffer and a value of 0 in usbReqCount . To get the full 64 bits, specify the size of the UInt64 structure in the usbReqCount field and pointer to an address of the structure in usbBuffer .

This function does not call the completion routine. However, a value is required in the usbCompletion field. kUSBNoCallBack can be specified as the completion routine.

The USBGetNextFrameNumberImmediate function returns the following error:

kUSBUnknownDeviceErr
-6998 usbReference does not refer to a current device

© 1999 Apple Computer, Inc.

Previous | Back Up One Level | Next | Show Frames | Hide Frames